public class vendingmachine {
    int price=80;
    int balance;
    int total;

    void showPrompt(){
        System.out.println("你好");
    }
    void insertMoney(int amount){
        balance=balance+amount;
    }
    void showBalance(){
        System.out.println(balance);
    }
    void getFood(){
        if(balance>=price){
            System.out.println("商品已弹出");
            balance=balance-price;
            total=total+price;
        }
    }
    public static void main(String[] args){
        vendingmachine vm=new vendingmachine();
        vm.showPrompt();
        vm.showBalance();
        vm.insertMoney(100);
        vm.getFood();
        vm.showBalance();
    }
}
